package wrapandunwrap;

public class WrapDemo {

    public static void main(String[] args) {

        int num = 100;
        Integer i = num; //自动装箱

        Integer i2 = new Integer(100);

        int num2 = i2; //自动拆箱

        //字符串转整数
        String s = "100";
        Integer i3 = Integer.parseInt(s);
        int num3 = Integer.parseInt(s);

        //整数转字符串
        int num4 = 100;

        String s1 = num4+""; //方式一：拼接空字符串
        String s2 = String.valueOf(num4); //方式二：String.valueOf();
        String s3 = new Integer(num4).toString();//方式三：使用 Object类的toString();

    }
}
